package cn.regexp.product.web.controller;

import cn.regexp.common.core.web.Result;
import cn.regexp.product.domain.Product;
import cn.regexp.product.service.IProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author Regexpei
 * @date 2024/7/5 21:25
 * @description 商品控制器
 */
@Slf4j
@RestController
public class ProductController {

    @Autowired
    private IProductService productService;

    @PostMapping("/product/queryProductByIds")
    public Result<List<Product>> queryProductByIds(@RequestParam("ids") List<Long> ids) {
        // 根据 ids 集合查询商品信息
        List<Product> products = productService.queryProductByIds(ids);
        return Result.success(products);
    }
}
